package com.wuxiaofan.coupon.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wuxiaofan.coupon.entity.SmsCouponHistory;
import com.wuxiaofan.coupon.entity.custom.SmsCouponHistoryCustom;
import com.wuxiaofan.coupon.mapper.SmsCouponHistoryMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.wuxiaofan.coupon.client.Idgenerator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;

@Service
public class SmsCouponHistoryService {
    @Autowired
    private SmsCouponHistoryMapper smsCouponHistoryMapper;
    @Resource
    private Idgenerator idgenerator;
    public SmsCouponHistory findById(String id){
        return smsCouponHistoryMapper.selectById(id);
    }

    public SmsCouponHistoryCustom findCountByMap(Map paraMap){
        return smsCouponHistoryMapper.findCountByMap(paraMap);
    }

    public SmsCouponHistoryCustom findGroupByMap(Map paraMap){
        return smsCouponHistoryMapper.findGroupByMap(paraMap);
    }

    public List<SmsCouponHistoryCustom> findByMap(Map paraMap){
        return smsCouponHistoryMapper.findByMap(paraMap);
    }

    public Page<SmsCouponHistoryCustom> findByMap(Map paraMap, Page page){
        return page.setRecords(smsCouponHistoryMapper.findByMap(paraMap,page));
    }


    public void updateMapById(Map paraMap){
        smsCouponHistoryMapper.updateMapById(paraMap);
    }
    public void delById(String id){
        smsCouponHistoryMapper.deleteById(id);
    }

    public SmsCouponHistory save(SmsCouponHistory smsCouponHistory){
        smsCouponHistory.setId(idgenerator.getId());
        smsCouponHistoryMapper.insert(smsCouponHistory);
        return smsCouponHistory;
    }

}
